/**
 * elancom Corporation copy right 2012 - 2015  
 *   
 * $Header: https://192.168.1.224/svn/elancom/product/elancom-platform/trunk/src/main/java/com/elancom/framework/filter/XRequestedWithFilter.java 1034 2012-07-02 03:09:12Z lanzhouxue $
 * $Id: XRequestedWithFilter.java 1034 2012-07-02 03:09:12Z lanzhouxue $
 * $Author: lanzhouxue $
 * $Date: 2012-07-02 11:09:12 +0800 (周一, 02 七月 2012) $
 * $Revision: 1034 $
 */
package com.elancom.framework.web.filters;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.filter.GenericFilterBean;

/**
 * fix:firefox
 * 
 * @author elancom
 * @date 2012-6-15
 */
public class XRequestedWithFilter extends GenericFilterBean {

	@Override
	public void doFilter(ServletRequest arg0, ServletResponse arg1, FilterChain arg2) throws IOException, ServletException {
		HttpServletRequest request = (HttpServletRequest) arg0;
		String name = request.getHeader("x-requested-with");

		if (name != null) {
			HttpServletResponse response = (HttpServletResponse) arg1;
			response.setContentType("html");
		}

		arg2.doFilter(arg0, arg1);
	}

}
